package com.mlethe.library.dialog.demo;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.mlethe.library.dialog.DialogFragment;
import com.mlethe.library.dialog.demo.databinding.DialogTestOneBinding;

/**
 * @author Mlethe
 * @date 2020/8/5
 */
public class TestOneDialog extends DialogFragment {

    private DialogTestOneBinding binding;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = DialogTestOneBinding.inflate(inflater, container, false);
        return binding.getRoot();
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        binding.dialogCancelBtn.setOnClickListener(v -> dismiss());
        binding.dialogConfirmBtn.setOnClickListener(v -> dismiss());
    }

    @Override
    protected boolean getNoTitle() {
        return true;
    }

    @Override
    protected boolean getCancelableOnTouchOutside() {
        return true;
    }

    @Override
    protected float getDimAmount() {
        return 0.3f;
    }
}
